package com.gitee.ykr.lightweight.rpc.common.enums;

/**
 * 线程队列类型
 * @author YKR
 * @Describe
 * @date 2021/8/23
 */
public enum ThreadQueueType {
    LINKED_BLOCKING_QUEUE( "LinkedBlockingQueue" ),
    ARRAY_BLOCKING_QUEUE( "ArrayBlockingQueue" ),
    SYNCHRONOUS_QUEUE( "SynchronousQueue" );

    private String value;

    ThreadQueueType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static ThreadQueueType fromString(String value) {
        for (ThreadQueueType type : ThreadQueueType.values()) {
            if (type.getValue().equalsIgnoreCase( value.trim() )) {
                return type;
            }
        }

        throw new IllegalArgumentException( "Mismatched type with value=" + value );
    }

    @Override
    public String toString() {
        return value;
    }
}
